//
//  NewListViewController.m
//  TenThousand
//
//  Created by baixue on 16/7/29.
//  Copyright © 2016年 baixue. All rights reserved.
//

#import "NewListViewController.h"

@interface NewListViewController ()
{
    UIWebView *_webView;
}

@end

@implementation NewListViewController

- (GetNewListModel *)model {
    if (!_model) {
        _model = [[GetNewListModel alloc] init];
    }
    return _model;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self getNewDetail];
    
    _webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, Screen_Width, Screen_Height-64)];
    
    [self.view addSubview:_webView];
    self.title = @"新闻详情";
    [self createLeft:[UIImage imageNamed:@"ZHSZicon_03"] leftClick:^{
        [self.navigationController popViewControllerAnimated:YES];
    } right:nil rightClick:nil];
    
    
}


-(void)getNewDetail{
    NSDictionary *para = @{
                           @"NewId":self.model.NewId
                           };
    
    [NetWorkManager requestWithType:HttpRequestTypePost withMethodName:@"Image.GetNewDetail" withParaments:para withSuccessBlock:^(NSDictionary *object) {
        NSLog(@"%@",object);
        NSString *str = object[@"Data"];
        NSArray *dic = [NetWorkManager arrayWithJsonString:str];
        NSString *title = [NSString stringWithFormat:@"<b><h1 style=\"color:black;text-align:center;font-size:25px;background-color:white\">%@</h1></b>", dic[0][@"NewTitel"]];
        NSString *html = [title stringByAppendingString:dic[0][@"NewContect"]];
        [_webView loadHTMLString:html baseURL:nil];
        
    
    } withFailureBlock:^(NSError *error) {
        NSLog(@"%@",error);
    } progress:nil];
    
}

@end
